<script type="text/javascript" src="ccay/example/ui/igrid/neiqian.js" charset="utf-8" ></script>


<div class='ccay-grid-toolbar'><input id='addBut'  value='insert' type='button' /></div>
<div id="igridDemo2"></div>

			    <h3>html Code</h3>
				<div class='codeArea'>
					<pre id='html1'>
&lt;div class='ccay-grid-toolbar'>&lt;input id='addBut'  value='insert' type='button' />&lt;/div>
&lt;div id="igridDemo2">&lt;/div>
</pre>
			</div>
<h3>JS Code</h3>
				<div class='codeArea'>
					<pre id='js1'>
var gridOption2 = {
		onRowClick:function(val,rowdata,td, tr,colId,rowId,col, grid, e){
		if(!tr.data("inDivId") && $(e.srcElement).parents("[inTr]").length==0){
			tr.data("inDivId",new Date().getTime()) ;
			var inTd =   $.create("td").attr("colspan",tr.children().length).addClass("grid-cell");
			var inTr =  $.create("tr","",tr.data("inDivId")).attr("inTr","");
			var inGridDiv = $.create("div", "", "gridId_"+rowId);
			var inDiv = $.create("div" ).css({"margin":"5px"});		
			inDiv.append("&lt;div class='ccay-grid-toolbar'>&lt;input id='gridId_"+rowId+"_addBut'  value='insert' type='button' />&lt;/div>")
			inTr.append(inTd.append(inDiv.append(inGridDiv)));
			tr.after(inTr);
			
			var gridOption3 = {
				pagerOp:{
					pageSizes:[2]
				},
				editMode: true,
				columns: [
					 {field: 'name', width: 80, header: "ccay.common.label.name"}, 
					 {field: 'sex', width: 70, header: "Sex", type: 'bool', sortable: false},
					 {field: 'age', width: 70, header: "Age", cssName: "center", sort: 'desc', resizable: false}],
				ajax:{
						url: 'services/ccay/demo/student/list/page/2/${curPage}/${orderBy}'
					},
				operation: {
							insert:{
										
									btn: "#gridId_"+rowId+"_addBut",
									copy: true
								}
				}				
			}
			$("#gridId_"+rowId).igrid(gridOption3);     	
		}else if(tr.data("inDivId")){
			$("#"+tr.data("inDivId")).toggle();
		}
		
		
	},
		columns: [

		 {field: 'name', width: 80, header: "ccay.common.label.name"}, 
		 
		
		 {field: 'sex', width: 70, header: "Sex", type: 'bool', sortable: false},
		 
		 
		 {field: 'age', width: 70, header: "Age", cssName: "center", sort: 'desc', resizable: false},
		 
		
		 {field: 'birthday', width: 90, header: "Birthday", type: 'date',freezeable: true}
		],
		ajax:{
			url: 'services/ccay/demo/student/list/page/${pageSize}/${curPage}/${orderBy}'
		},
		operation: {
				insert:{
							
						btn: "#addBut",
						copy: true
					}
		}
	};

	$("#igridDemo2").igrid(gridOption2);  
</pre>
			</div>